<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>
    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>
                <div class="page-content-area">
                    <div class="row">
                        <div class="col-xs-12">
                            <!-- PAGE CONTENT BEGINS -->
                            <if condition="session('uid') eq 1">
                            <div class="cf">
                                <a class="btn btn-info" href="{:U('add')}" value="">新增</a>
                            </div>
                            </if>
                            <!--/span-->
                            <!-- left menu ends -->
                            
                            <ul class="list-group" style="margin-left:0">
                                <volist name="data.list" id="vo">
                                <li class="list-group-item notice-item">
                                    <span>{$vo.create_time|date='Y-m-d' , ###} | </span><a href="javascript:openLayer('{$vo.id}' , '{$vo.title}')" class="notice-title">{$vo.title}</a>
                                    <if condition="session('uid') eq 1">
                                        <div class="col-xs-1"><a href="{:U('add' , ['id' => $vo['id']])}">编辑</a>
                                            <a href="javascrtip:;" data-id='{$vo.id}' class='btn-del'>删除</a></div>
                                    </if>
                                </li>
                                </volist>
                            </ul>
                            {$data.page}
                            <!-- PAGE CONTENT ENDS -->
                        </div><!-- /.col -->
                    </div><!-- /.row -->
                </div><!-- /.page-content-area -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel"></h4>
                </div>
                <div class="modal-body"></div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">我知道了</button>

                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <include file="Public/footer"/>
</div><!-- /.main-container -->
<include file="Public/footerjs"/>
<script src="__PUBLIC__/qwadmin/js/date-time/bootstrap-datepicker.js"></script>
<style>

    .pagination div  a, .pagination div .current{
        position: relative;
        float: left;
        padding: 6px 12px;
        margin-left: -1px;
        line-height: 1.42857143;
        color: #009688;
        text-decoration: none;
        background-color: #fff;
        border: 1px solid #ddd;
    }

    .pagination div .current{
        background:#009688;
        color:#FFF;
        border-color:#009688;
    }
</style>
<script type="text/javascript">
        $(function () {
            $(".btn-del").on("click", function () {
                var id = $(this).attr("data-id");
                $.get("{:U('del')}", {id: id}, function (data) {
                    if (data.status == 1) {
                        layer.alert(data.msg, function () {
                            window.location.reload();
                        })
                    } else {
                        layer.alert(data.msg);
                    }
                });
            });
        });

        function openLayer(id, title) {
            $.get("{:U('Ammount/view')}", {id: id}, function (data) {
                if (data != 0) {
                    $("#myModal").modal({});
                    $("#myModalLabel").text(data[0].title);
                    $(".modal-body").html(data[0].content);
                }
            });
        }
</script>
</body>
</html>